package com.yupi.springbootinit.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yupi.springbootinit.mapper.QualityInspectionRecordMapper;
import com.yupi.springbootinit.model.entity.QualityInspectionRecord;
import com.yupi.springbootinit.service.QualityInspectionRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 质检记录服务实现
 */
@Slf4j
@Service
public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspectionRecordMapper, QualityInspectionRecord>
        implements QualityInspectionRecordService {

    @Override
    public boolean saveInspectionRecord(QualityInspectionRecord record) {
        boolean saved = this.save(record);
        if (saved) {
            log.info("质检记录保存成功: id={}, stepId={}, result={}", record.getId(), record.getStepId(), record.getInspectionResult());
        } else {
            log.error("质检记录保存失败: stepId={}, result={}", record.getStepId(), record.getInspectionResult());
        }
        return saved;
    }
}